home *** CD-ROM | disk | FTP | other *** search
- /* doccreat.c - creat a document index and data file */
- #include "stdio.h"
- #include "cminor.h"
- #include "btree.h"
- #include "bt_macro.h"
-
- #define WR_MODE 1 /* write access for open */
- extern ENTRY dume ;
- extern int ndum ;
-
- main(argc,argv)
- int argc ;
- char *argv[] ;
- {
- int ret ;
- char fn[65] ;
- RECPOS fs ;
-
- if( argc < 3 )
- { printf(" USAGE: - doccreat doc-file-name file_size \n") ;
- exit(5) ;
- }
-
- add_str(fn,argv[1],".idx",&fs) ;
-
- ret = sscanf(argv[2],"%1d",&fs) ;
- if( (ret == 0) || (fs < 0) )
- { printf(" bad file size specification \n") ;
- exit(6) ;
- }
-
- if( creatix(fn,fs,&dume,ndum) < 0 )
- { printf(" can't create the index file \n") ;
- exit(10) ;
- }
-
- add_str(fn,argv[1],".dat") ;
- ret = gcreat(fn,WR_MODE,BIN_MODE) ;
- if( ret < 0 )
- { printf(" can't create the data file \n") ;
- exit(12) ;
- }
- close(ret) ;
- }
-
-
-
-
-